{extend name="index_layout"/}
{block name="main"}
<form class="layui-form" method="post">
    
    <div class="layui-form-item">
        <label class="layui-form-label">产品编号 </label>
        <div class="layui-input-block">
            <select name="product_id" id="" class="layui-disabled" disabled lay-filter="findProductName">
                <option value="0">请选择</option>
                {volist name="product" id="item"}
                <option {if $wages.product_id == $item.id} selected {/if} value="{$item.id}">{$item.nums}</option>
                {/volist}
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">产品名称 </label>
        <div class="layui-input-block">
            <input type="text" disabled value="{$wages.title}" class="layui-input layui-disabled product_name">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">工序名称 </label>
        <div class="layui-input-block">
            <select name="procedure_id"">
                <option value="0">请选择</option>
                {volist name="procedureList" id="item"}
                <option {if $wages.procedure_id == $item.id} selected {/if} value="{$item.id}">{$item.title}</option>
                {/volist}
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">计件方式 </label>
        <div class="layui-input-block">
            <select name="type"">
                <option {if $wages.type == 1} selected {/if} value="1">计件</option>
                <option {if $wages.type == 2} selected {/if} value="2">计时</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><span class="bitian">*</span>工资单价(元) </label>
        <div class="layui-input-block">
            <input type="number" name="prices" value="{$wages.prices}" lay-verify="required" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item" style="width: 20%;float:left;clear: none;">
        <label class="layui-form-label">标准效率 </label>
        <div class="layui-input-block">
            <input type="number" name="counts" value="{$wages.counts}" placeholder="单位时间产出" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item" style="width: 15%;float:left;clear: none;">
        <label class="layui-form-label">小时 </label>
        <div class="layui-input-block">
            <input type="number" name="hours" value="{$wages.hours}" placeholder="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item" style="width: 15%;float:left;clear: none;">
        <label class="layui-form-label">分钟 </label>
        <div class="layui-input-block">
            <input type="number" name="minutes" value="{$wages.minutes}" placeholder="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item" style="width: 15%;float:left;clear: none;">
        <label class="layui-form-label">秒 </label>
        <div class="layui-input-block">
            <input type="number" name="seconds" value="0" placeholder="" class="layui-input">
        </div>
    </div>
    <input type="hidden" name="id" value="{$wages.id}">
    <!-- <input type="number" style="width: 10%;float:left" name="minutes" class="layui-input">分钟
    <input type="number" style="width: 10%;float:left" name="seconds" class="layui-input">秒 -->

    
    <div class="layui-form-item layer-footer">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter='ds' type="button" data-refresh="false">立即提交</button>
            <button class="layui-btn layui-btn-normal" type="button" onclick="var index1 = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index1);">返回</button>
        </div>
    </div>
</form>

{/block}

{block name="script"}
<script>
    layui.use(['form','yznForm'], function() {
        var form = layui.form;
        var yznForm = layui.yznForm
        form.on('select(findProductName)',function(data){
            $.post('{:url("findProductName")}',{id:data.value},function(res){
                $('.product_name').val(res.title)
            })
        })
        var yznForm = layui.yznForm;
        yznForm.listen();
        // form.on('submit(ds)',function(data){
        //     var param = data.field;
        //     $.post('{:url("editPost")}',param,function(res){
        //         if(res.code > 0){
        //             layer.msg('添加成功');
        //             setTimeout(() => {
        //                 var index1 = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
        //                 parent.layer.close(index1);
        //                 parent.location.reload();
        //             }, 500);
        //         }else{
        //             layer.msg(res.msg);
        //         }
        //     },'json');
        // })
    })
</script>
{/block}